home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
cnet
/
cnettoolkit2a.lha
/
Routines
/
PARSE_SORT
< prev
next >
Wrap
Text File
|
1994-12-13
|
822b
|
16 lines
PARSE: procedure expose it.; arg rng,min,max,srt
it.='';c=0;it=translate(rng,' ','.,')
do a=1 to words(it);c=c+1;it.c=word(it,a)
if index(it.c,'-')>0 then do;parse var it.c x'-'y
if y='' then y=max;if x='' then x=min
if x>y then do;d=x;x=y;y=d;end
if x<min|y>max|~datatype(x,'W')|~datatype(y,'W') then do;c=c-1;iterate;end
do b=x to y;it.c=b;c=c+1;end;c=c-1;end
else if it.c<min|it.c>max|~datatype(it.c,'W') then do;c=c-1;iterate;end;end
if c>0 & upper(arg(4))='S' then do;do a=1 to c-1;d=a;do b=a+1 to c;d=d+1
if it.d<it.a then do;y=it.a;it.a=it.d;it.d=y;end
else if it.d=it.a then do;it.d=it.c;c=c-1;d=d-1;end;end;end;end;a=0
do i=1 to c;j=i+1;if it.i~=it.j then do;a=a+1;it.a=it.i;end;end;c=a
do i=1 to c;it.0=it.0||it.i' ';end
return c